package com.wedimob.slideshare.bo;

import java.net.URI;
import java.net.URL;

public class Medium extends AbstractBO<Medium> {

    private MediumType type;
    private String label;
    private URL url;
    private URI path;

    public Medium(URL url) {
        super();
        this.url = url;
    }

    public Medium(MediumType type, String label, URL url, URI path) {
        super();
        this.type = type;
        this.label = label;
        this.url = url;
        this.path = path;
    }

    public String getLabel() {
        return label;
    }

    public URL getUrl() {
        return url;
    }

    public MediumType getType() {
        return type;
    }

    public URI getPath() {
        return path;
    }

    public String getFilePath() {
        return path + "/" + label + getExtension();
    }

    private String getExtension() {
        switch (type) {
        case FLASH:
            return ".flv";

        case HTML:
            return ".htm";

        case PDF:
            return ".pdf";

        case SOUND:
            return ".mp3";

        case PICTURE:
            return ".jpeg";

        case VIDEO:
            return ".mp4";

        default:
            return "";
        }

    }
}
